Page({
    data: {
        titles: ['手机', '电脑', 'iPad', '相机'],
        currentIndex: 0
    },
    onItemTap(e) {
        const { index } = e.currentTarget.dataset
        this.setData({
            currentIndex: index
        })
    },
    onBtnClick(e) {
        console.log('事件监听', e)
    },
    onOuterViewTap(e) {
        // 1. target: 触发事件的元素
        // 2. currentTarget: 处理事件的元素
        console.log('outerViewTap:', e)
        console.log('e.currentTarget:', e.currentTarget)
        console.log('e.target:', e.target)
        console.log(e.currentTarget === e.target)

        console.log('name:', e.currentTarget.dataset.name)
    },
    // 触摸事件
    onTouchTap(e) {
        console.log('tap:', e)
    },
    onTouchEnd(e) {
        console.log('end:', e)
    },
    onLongPress(e) {
        console.log('long', e)
    },
    // 监听事件, 并且传递参数
    onArguemntsTap(e) {
        const {name, age, gender} = e.currentTarget.dataset

        console.log('name:', name, 'age:', age, 'gender:', gender)
    },
    // 冒泡和捕获
    onView1CaptureTap() {
        console.log('onView1CaptureTap')
    },
    onView2CaptureTap() {
        console.log('onView2CaptureTap')
    },
    onView3CaptureTap() {
        console.log('onView3CaptureTap')
    },
    onView1Tap() {
        console.log('onView1Tap')
    },
    onView2Tap() {
        console.log('onView2Tap')
    },
    onView3Tap() {
        console.log('onView3Tap')
    },
    onMarkTap(e) {
        const data = e.currentTarget.dataset
        const data2 = e.mark
        console.log(data2, data)
    }
})